//import {ethers}  from "https://cdnjs.cloudflare.com/ajax/libs/ethers/5.7.2/ethers.min.js";
import { ethers } from "./ethers.min.js";

export default class HelloWorldContract {
  abiStr = '[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"newname","type":"string"}],"name":"onset","type":"event"},{"inputs":[],"name":"get","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"n","type":"string"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"}]';
  abiInterface = new ethers.Interface(this.abiStr)
  constructor() {

  }
  create_set_data(data) {
    var funcdata_hex = this.abiInterface.encodeFunctionData("set", [data ]);
    return funcdata_hex;
  }

  create_get(){
      var funcdata_hex = this.abiInterface.encodeFunctionData("get", []);
      return funcdata_hex;
  }
  //document.getElementById("test").innerHTML = funcdata_hex;
}


